img = imread('img-3.png');
imshow(img);
title('原图');

subplot(1,2,2);
threshold = graythresh(img);
b = im2bw(img);
imshow(b);
title("二值化")
% writematrix(b,".\b1.csv")
dlmwrite("img.txt",b,'delimiter',' ');